﻿using System.Collections.Generic;
using PetaPoco;

namespace Common.Orm
{
    public interface IRepository<T>
    {
        object Add(T t);

        bool Delete(T t);

        bool DeleteById(object primaryKey);

        bool Update(T t);

        T Load(object primaryKey);

        List<T> GetAll(string orderBy);

        List<T> GetTopList(int topSize, Sql conditions, string orderBy);

        List<T> GetTopList(int topSize, Sql conditions, List<JoinTable> joinTables, string orderBy);

        List<T> GetList(Sql conditions, string orderBy);

        List<T> GetJoinList(Sql conditions, List<JoinTable> joinTable, string orderBy);

        Page<T> GetJoinPageList(int pageIndex, int pageSize, List<JoinTable> joinTable, Sql conditions, string orderBy);

        Page<T> GetPageList(int pageIndex, int pageSize, Sql conditions, string orderBy);

        Page<T> GetPageList(int pageIndex, int pageSize, string orderBy);

        string GetSql();

        object ExecuteSql(string sql, params object[] args);

    }


}